// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose:  To provide a shorthand for invoking IDispatch methods by name.
//   $Id$
#pragma once


//<summary>
//	Calls IDispatch::GetIdsofNames and IDispatch::Invoke based on the 
//	given arguments, and appropriate defaults.
//</summary>
//<param name="pDisp">
//	Pointer to the IDispatch object on which you wish execute the member.
//</param>
//<param name="bsName">Name of the dispatch member you wish to call</param>
//<param name="pParams">
//	Arguments to pass to pDisp. Don't forget that DISPPARAMS is reversed.
//</param>
//<param name="pvtResult">
//	Pointer to a variant to receive the return value from Invoke
//</param>
//<param name="dispid">
//	in/out parameter to allow a caller to cache the result
//	of getIdsOfNames.
//</param>
//<param name="wFlags">
//	wFlags parameter to pass to Invoke.  Defaults to DISPATCH_METHOD
//</param>
//<param name="lcid">
//	locale id in which to perform GetIdsOfNames and Invoke.  Defaults to
//	LOCALE_SYSTEM_DEFAULT
//<param>
//<param name="pexcepinfo">
//	pexcepinfo parameter to pass to Invoke.  Defaults to NULL
//<param>
//<param name="puArgErr">
//	puArgErr parameter to pass to Invoke.  Defaults to NULL
//<param>

HRESULT InvokeDispatch
(
	LPDISPATCH pDisp,
	BSTR bsName,
	DISPPARAMS * pParams,
	VARIANT * pvtResult,
	DISPID & dispid,
	WORD wFlags=DISPATCH_METHOD,
	LCID lcid=LOCALE_SYSTEM_DEFAULT,
	EXCEPINFO* pexcepinfo=0,
	UINT* puArgErr=0
);